package fun.coding.codejam2014;

import java.util.Scanner;

public class MagicTrick {

	
	public static void main(String[] args) {
		Scanner scanIn = new Scanner(System.in);
		
		int[][] input1 = new int[4][4];
		int[][] input2 = new int[4][4];
		
		int testCaseNum = scanIn.nextInt();
		int iter = 1;
		
		while (iter <= testCaseNum) {
			int r1 = scanIn.nextInt();
			
			for (int i = 0; i < 4; i++) {
				for (int j = 0; j < 4; j++) {
					input1[i][j] = scanIn.nextInt();
				}
			}
			
			int r2 = scanIn.nextInt();
			
			for (int i = 0; i < 4; i++) {
				for (int j = 0; j < 4; j++) {
					input2[i][j] = scanIn.nextInt();
				}
			}
			
			String result = solver(input1[r1 - 1], input2[r2 - 1]);
			System.out.println(String.format("Case #%d: %s", iter, result));
			iter++;
		}
		
		//scanIn.close();
	}
	
	public static String solver(int[] a, int[] b) {
		int[] check = new int[17]; // default 0
		
		for (int i : a) {
			check[i]++;
		}
		
		for (int i : b) {
			check[i]++;
		}
		
		int two = 0;
		int index = 0;
		
		for (int i = 0; i < 17; i++) {
			if (check[i] == 2) {
				two++;
				index = i;
			}
		}
		
		if (two == 1) {
			return String.valueOf(index);
		} else if (two == 0) {
			return "Volunteer cheated!";
		} else {
			return "Bad magician!";
		} 
	}
}
